package com.mrx.pvzcommunity.model.user;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;


@Data
@ApiModel(value = "信息脱敏的 用户对象")
@NoArgsConstructor
public class NormalUser implements Serializable {
    @ApiModelProperty(value = "用户 邮箱", example = "1@qq.com")
    private String mail;

    @ApiModelProperty(value = "用户 ID", example = "1", hidden = true)
    private long uid;
    @ApiModelProperty(value = "用户 昵称", example = "nickName")
    private String uname;

    public NormalUser(User user) {
        this.uid = user.getUid();
        this.uname = user.getUname();
        this.mail = user.getMail();
    }

    public AvatarUser toAvatarUser() {
        return new AvatarUser(this);
    }
}
